<template>
  <div>
    教师提交的课题审核
    <el-button>
      <router-link to="/write_paper">添加毕业设计题目</router-link>
    </el-button>
    <template>
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column label="题目" width="260">
          <template slot-scope="scope">
            <a href="javascript:;" @click="show(scope.row)">{{
              scope.row.topic_name
            }}</a>
          </template>
        </el-table-column>
        <el-table-column label="来源" width="180">
          <template slot-scope="scope">
            <span style="margin-left: 10px">{{ scope.row.topic_from }}</span>
          </template>
        </el-table-column>
        <el-table-column label="类型">
          <template slot-scope="scope">
            <span style="margin-left: 10px">{{ scope.row.topic_type }}</span>
          </template>
        </el-table-column>
        <el-table-column label="审核状态">
          <template slot-scope="scope">
            <span style="margin-left: 10px">{{ scope.row.status }}</span>
          </template>
        </el-table-column>
      </el-table>
    </template>

    <!-- 发布的课题详情 -->
    <el-dialog title="详情" :visible.sync="dialogVisible" width="60%">
      <el-descriptions class="margin-top" :column="2" border>
        <el-descriptions-item>
          <template slot="label"> 课题名称 </template>
          {{ msg.topic_name }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label"> 可带学生 </template>
          {{ msg.allow_num }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label"> 课题来源 </template>
          {{ msg.topic_from }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label"> 课题类型 </template>
          {{ msg.topic_type }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label"> 课题难易程度 </template>
          {{ msg.topic_degree }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label"> 课题工作量 </template>
          {{ msg.topic_work }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label"> 课题所需条件是否具备 </template>
          {{ msg.topic_is }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label"> 课题内容介绍 </template>
          {{ msg.topic_content }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label"> 毕业设计（论文）要求 </template>
          {{ msg.paper_requirement }}
        </el-descriptions-item>
      </el-descriptions>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  created() {
    this.gettopic();
  },
  data() {
    return {
      dialogVisible: false,
      status1: [],
      tableData: [],
      msg: {},
    };
  },

  methods: {
    show(row) {
      this.dialogVisible = true;
      this.msg = row;
    },
    // 获取教师发布的课题信息
    gettopic() {
      this.$http
        .get("http://127.0.0.1:8080/teacher/teacaherTopic")
        .then((res) => {
          // console.log(res.data.data);
          this.tableData = res.data.data;
          this.tableData.forEach((val) => {
            if (val.pass == 0) {
              Object.assign(val, { status: "未审核" });
            }
            if (val.pass == 1) {
              Object.assign(val, { status: "通过" });
            }
          });
          // console.log(this.tableData);
        });
    },
  },
};
</script>
<style lang="less" scoped>
</style>
